<template>
	<view class="detail">
		<view class="detail_title" v-for="item in detailData" :key="item.id">
			<text>{{item.title}}</text>
			<view class="detail_bottom">
				<view class="detail_time">发布时间：{{item.add_time | handleTime}}</view>
				<view class="detail_number">浏览：{{item.click}}</view>
			</view>
			<rich-text :nodes="item.content" class="rich_text"></rich-text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				detailData:[]
			}
		},
		methods: {
			async getGoodsDatail(id){
				const res = await this.$request({
					url:`/api/getnew/${id}`
				})
				this.detailData  = res.data.message
			}
		},
		onLoad(option) {
			this.getGoodsDatail(option.newid)
		},
		filters:{
			handleTime(date){
				return date.slice(0,date.indexOf('T'))
			}
		}
	}
</script>

<style lang="less" scoped>
.detail{
	padding: 20rpx;
	.detail_title{
		display: flex;
		flex-direction: column;
		text{
			font-size: 28rpx;
			font-weight: 600;
		}
		.detail_bottom{
			margin-top: 20rpx;
			display: flex;
			justify-content: space-between;
			font-size: 24rpx;
			.detail_time{}
			.detail_number{}
		}
		.rich_text{
			margin-top: 20rpx;
			font-size: 24rpx;
		}
	}
}
</style>
